home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / FROMUTS / UNIXLIB37B / src / c / strcat < prev    next >
Text File  |  1990-09-26  |  760b  |  48 lines

  1. #ifdef __STDC__
  2. static char sccs_id[] = "@(#) strcat.c 1.1 "__DATE__" HJR";
  3. #else
  4. static char sccs_id[] = "@(#) strcat.c 1.1 26/9/90 HJR";
  5. #endif
  6.  
  7. /* strcat.c (c) Copyright 1990 H.Rogers */
  8.  
  9. #ifndef __STDC__
  10. #include "sys/types.h"
  11. #endif
  12. #include <string.h>
  13.  
  14. #ifdef __STDC__
  15. char *strcat(char *s,register const char *s2)
  16. #else
  17. char *strcat(s,s2)
  18. char *s;
  19. register const char *s2;
  20. #endif
  21. {
  22. register char *s1 = s;
  23.  
  24. while (*s1++); --s1;
  25.  
  26. while (*s1++ = *s2++);
  27.  
  28. return(s);
  29. }
  30.  
  31. #ifdef __STDC__
  32. char *strncat(char *s,register const char *s2,register size_t n)
  33. #else
  34. char *strncat(s,s2,n)
  35. char *s;
  36. register const char *s2;
  37. register size_t n;
  38. #endif
  39. {
  40. register char *s1 = s;
  41.  
  42. while (*s1++); --s1;
  43.  
  44. while (*s1++ = *s2++) if (!(n--)) { *--s1 = 0; break; }
  45.  
  46. return(s);
  47. }
  48.